package location.general;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author avbravo
 */
@ManagedBean(name = "location_countryBeans")
@RequestScoped
public class Beans {

    private Integer id = 0;
    private String nombre = "";

    public Beans() {
    }

    public Beans(int id, String nombre_pais) {
        this.id = id;
        this.nombre = nombre_pais;
    }

    public void clearBeans() {
        this.id = 0;
        this.nombre = "";
    }

    private String strScape(String str) {
        str = str.trim();
        str = str.replace("'", "''");
        str = str.replace("\\", "\\\\");
        return str;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        if (id == null) {
            id = 0;
        }
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre_pais) {
        this.nombre = strScape(nombre_pais);
    }
}
